package com.xiu.travel.util;

/**
 * @author lijie
 * @date 2023/6/28 14:05
 * @description GaodMapUtils
 */
public class GaodMapUtils
{
    /**
     * 1.直接程序计算
     */
    public static Double getDis(Double lat1,Double lon1,Double lat2,Double lon2 ){
        Double radLat1=(lat1 * Math.PI) /180;
        Double radLat2=(lat2 * Math.PI) /180;
        Double a=radLat1-radLat2;
        Double b=(lon1 * Math.PI) /180 -(lon2 * Math.PI)/180;
        Double s=2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(
                Math.sin(b / 2), 2)));
        s=s* 6378137.0;
        return s;
    }
}
